from typing import List

class Solution(object):
    def isPalindrome(self, x: int) -> bool:
        if x < 0:
            return False

        reNum=self.reverse(x)
        return reNum ==x

    def reverse(self, x: int) -> int:
        rev = 0
        while x>0:
            temp = x%10
            rev =rev*10+temp
            x=x//10
        return rev




if __name__=="__main__":
    solution = Solution()
    print(solution.isPalindrome(111))
    print(solution.isPalindrome(1331))
    print(solution.isPalindrome(0))
    print(solution.isPalindrome(-321))